package com.liwenfeng.diancanspringboot.mapper;

import com.liwenfeng.diancanspringboot.pojo.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface OrderDetailMapper {
    void insertBatch(ArrayList<OrderDetail> orderDetails);

    /**
     * 根据订单id查询订单明细
     * @param orderId
     * @return
     */
    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> getByOrderId(Long orderId);

    @Select("select * from order_detail where id = #{id}")
    OrderDetail getById(Long id);

    void update(OrderDetail orderDetail);

    // 查询订单明细(手机端User模块)(浏览器端)
    @Select("select * from order_detail where order_id = #{orderId} and status != 4")
    List<OrderDetail> getValidByOrderId(Long orderId);

    List<OrderDetail> listByStatus(List<Integer> statusList);

    @Select("select * from order_detail where place = #{place} and status <4")
    List<OrderDetail> getByPlace(Integer place);

    List<OrderDetail> getOrderDetails(OrderDetail orderDetail);
}
